<?php

if(isset($_POST['dirIdEdit']) && isset($UID)){
#if it is a dirAdd request

  $dirIdEdit   = $_POST['dirIdEdit'];

  require_once $BASE_PATH . 'm/dir.php';

  $dircn = new DIR(DBHOST, DBUSER, DBPASS, DBNAME);

  $dirEdit = $dircn->getById($dirIdEdit);

  $dirParent = $dircn->getById($dirEdit['parent']);

  $dircn->alt($dirParent['id'], $dirParent['parent'], $dirParent['name'], $dirParent['subdir'] - 1, $dirParent['file'], $dirParent['uid']);

  $dircn->delById($dirIdEdit);

  require_once $BASE_PATH . 'm/bookmark.php';
  $bmcn = new Bookmark(DBHOST, DBUSER, DBPASS, DBNAME);
  $bookmark = $bmcn->get($UID);

  echo '{"code": 0, "data":' . json_encode($bookmark) . '}';
}
